import java.util.ArrayList;

public class Test2 {
    public static ArrayList<Character> func(String s1,String s2){
        ArrayList<Character> arrayList = new ArrayList<>();
        for (int i = 0; i < s1.length(); i++) {
            char ch = s1.charAt(i);
            if(!s2.contains(ch+"")){
                arrayList.add(ch);
            }
        }
        return arrayList;
    }
    public static ArrayList<Character> func2(String s1,String s2){
        ArrayList<Character> arrayList1 = new ArrayList<>();
        ArrayList<Character> arrayList2 = new ArrayList<>();

        for (int i = 0; i < s1.length(); i++) {
            char ch = s1.charAt(i);
            arrayList1.add(ch);
        }
        for (int i = 0; i < s2.length(); i++) {
            char ch = s2.charAt(i);
            arrayList2.add(ch);
        }

        arrayList1.removeAll(arrayList2);
        return arrayList1;

    }
    public static void main(String[] args) {
        ArrayList<Character> arrayList = func("welcome to bit", "come");
        for (Character c : arrayList) {
            System.out.print(c);
        }
        System.out.println();
        ArrayList<Character> arrayList2 = func2("welcome to bit", "come");
        for (Character c : arrayList2) {
            System.out.print(c);
        }
    }
    public static void main2(String[] args) {
        String s1 = "welcome to bit";
        String s2 = "come";
        ArrayList<Character> arrayList = new ArrayList<>();
        for (int i = 0; i < s1.length(); i++) {
            char c = s1.charAt(i);
            boolean flg = false;
            for (int j = 0; j < s2.length(); j++) {
                char ch = s2.charAt(j);
                if(c == ch){
                    flg = true;
                }
            }
            if(!flg){
                arrayList.add(c);
            }
        }
        for (Character c:arrayList) {
            System.out.print(c);
        }
    }
    public static void main1(String[] args) {
        String s1 = "welcome to bit";
        String s2 = "come";

        ArrayList<Character> arrayList1 = new ArrayList<>();
        for (int i = 0; i < s1.length(); i++) {
            arrayList1.add(s1.charAt(i));
        }
        ArrayList<Character> arrayList2 = new ArrayList<>();
        for (int i = 0; i < s2.length(); i++) {
            arrayList2.add(s2.charAt(i));
        }

        arrayList1.removeAll(arrayList2);

        for (Character c:arrayList1) {
            System.out.print(c);
        }
    }
}
